﻿@page "/client"
@inject IStringLocalizer<Client> Localizer

<h3>@Localizer["Title"]</h3>

<h4>@Localizer["SubTitle"]</h4>

<DemoBlock Title="@Localizer["BasicUsageTitle"]" Introduction="@Localizer["BasicUsageIntro"]" Name="Normal">
    <p>@Localizer["BasicUsageP1"]</p>
    <div class="mb-3">
        <p>@((MarkupString)Localizer["BasicUsageP2"].Value)</p>
        <Pre>public void Configure(IApplicationBuilder app)
{
    // ...
    // 增加下面这一行
    app.UseBootstrapBlazor();
    app.UseEndpoints(endpoints =>
    {
        endpoints.MapDefaultControllerRoute();
        endpoints.MapBlazorHub();
        endpoints.MapFallbackToPage("/_Host");
    });
}</Pre>
    </div>

    <Tips>
        <p>@((MarkupString)Localizer["BasicUsageTips"].Value)</p>
    </Tips>

    <div class="mb-3">
        <p>@((MarkupString)Localizer["BasicUsageP3"].Value)</p>
        <Pre>[Inject]
[NotNull]
private WebClientService? ClientService { get; set; }

protected override async Task OnAfterRenderAsync(bool firstRender)
{
    await base.OnAfterRenderAsync(firstRender);

    if (firstRender)
    {
        await ClientService.RetrieveRemoteInfo();
        StateHasChanged();
    }
}
</Pre>
    </div>

    <GroupBox Title="@Localizer["GroupBoxTitle"]">
        <div class="row g-3 form-inline">
            <div class="col-12 col-sm-6">
                <Display Value="ClientService.Id" DisplayText="@Localizer["Id"]" ShowLabel="true" />
            </div>
            <div class="col-12">
                <Display Value="ClientService.RequestUrl" DisplayText="@Localizer["RequestUrl"]" ShowLabel="true" />
            </div>
            <div class="col-12 col-sm-6">
                <Display Value="ClientService.Ip" DisplayText="@Localizer["Ip"]" ShowLabel="true" />
            </div>
            <div class="col-12 col-sm-6">
                <Display Value="ClientService.OS" DisplayText="@Localizer["OS"]" ShowLabel="true" />
            </div>
            <div class="col-12 col-sm-6">
                <Display Value="ClientService.Browser" DisplayText="@Localizer["Browser"]" ShowLabel="true" />
            </div>
            <div class="col-12 col-sm-6">
                <Display Value="ClientService.Engine" DisplayText="@Localizer["Engine"]" ShowLabel="true" />
            </div>
            <div class="col-12 col-sm-6">
                <Display Value="ClientService.Device" DisplayText="@Localizer["Device"]" ShowLabel="true" />
            </div>
            <div class="col-12 col-sm-6">
                <Display Value="ClientService.Language" DisplayText="@Localizer["Language"]" ShowLabel="true" />
            </div>
            <div class="col-12">
                <BootstrapInput Value="ClientService.UserAgent" DisplayText="UserAgent" ShowLabel="true" readonly />
            </div>
        </div>
    </GroupBox>
</DemoBlock>
